{strip}

{literal}

<script>

function getAddForm(){
		
	$.ajax({
		type: "GET",
		url: "/users/add",
		data: {
			
		},
		success: function(data){
			showPopup(data, 'Add new user', false);
		},
		error: function(xhr, statusText, errorThrown){
			showPopup(xhr.responseText, statusText, false);
		}    
	
	});
}

function getEditForm(usersId){
		
	$.ajax({
		type: "GET",
		url: "/users/edit",
		data: {
			usersId: usersId
		},
		success: function(data){
			showPopup(data, 'Edit user details', false);
		},
		error: function(xhr, statusText, errorThrown){
			showPopup(xhr.responseText, statusText, false);
		}    
	
	});
}

function deleteUser(usersId){
	if (confirm('Are you sure you want to remove this user?')){
		$.ajax({
			type: "GET",
			url: "/users/delete",
			data: {
				usersId: usersId
			},
			success: function(data){
				//showPopup(data, 'Skinshop activation', false);
				window.location.reload();
			},
			error: function(xhr, statusText, errorThrown){
				showPopup(xhr.responseText, statusText, false);
			}
	
		});
		
	}
	return false;
}

</script>

{/literal}

<!-- content -->
<div id="content">
    <div id="content_left">
		<h2>USERS</h2>
		

		<a class="button_" href="#" onclick="getAddForm();">{$commonLocale->t('ADD NEW')}</a><br /><br />
		
		<table class="activeTable">
			<tr>
				<td>ID</td>
				<td>USERNAME</td>
				<td>EMAIL</td>
				<td>FIRST_NAME</td>
				<td>LAST_NAME</td>
				<!--<td>IS_ADMINISTRATOR</td>-->
				<!--<td>IS_OPERATOR</td>-->
				<td>STATUS</td>
				<!--<td>REGISTRATION_DATE</td>
				<td>LAST_UPDATE_DATE</td>-->
				<td> </td>
			</tr>
		{foreach from=$users item=u name=forU}
			<tr>
				<td>{$u->getId()}</td>
				<td>{$u->getUsername()}</td>
				<td>{$u->getEmail()}</td>
				<td>{$u->getFirstName()}</td>
				<td>{$u->getLastName()}</td>
				{*<td>{$u->getIsAdministrator()}</td>*}
				{*<td align="right">{$u->getIsOperator()}</td>*}
				<td>
					{$u->getStatus()->getStatus()}
					
				</td>
				{*<td>{$u->getRegistrationDate()|date_format}</td>
				<td>{$u->getLastUpdateDate()|date_format}</td>*}
				<td><a href="#" onclick="getEditForm({$u->getId()});">EDIT</a></td>
				<td><a href="#" onclick="deleteUser({$u->getId()});">DELETE</a></td>
			</tr>
		{/foreach}
		</table>
	</div>
	<div id="content_right">
		{include file='admin/menu.tpl'}
	</div>
</div>
<!-- end content  -->
{/strip}